Skip to content

fix: avoid blank rows in CSV exports on Windows - #88

Draft
rahul-mixpanel wants to merge 1 commit into
masterfrom
rahulraveendran-sdk-382-utils-49-csv-exports-skip
Draft

rahul-mixpanel wants to merge 1 commit into
masterfrom
rahulraveendran-sdk-382-utils-49-csv-exports-skip

Conversation

@rahul-mixpanel

Copy link
Copy Markdown
Contributor

Summary

_write_items_to_csv opened the output file in text mode without newline="". csv.writer already ends each row with \r\n, so on Windows the \n is translated again to \r\n. Each row then ends with \r\r\n, and spreadsheet tools show a blank row after every record. This is the case the csv docs warn about.

The fix passes newline="" to open() at src/mixpanel_utils/__init__.py:1854.

Customer impact: on macOS and Linux the bytes written are unchanged. On Windows, rows now end with a single \r\n instead of \r\r\n.

Related to #49 (SDK-382)

Test plan

  • New tests/test_write_items_to_csv.py simulates Windows newline translation. It fails without the fix and passes with it.
  • Full suite: 60 passed

🤖 Generated with Claude Code

csv.writer emits \r\n row terminators; opening the file in text mode
without newline='' lets Windows translate the \n again, producing
\r\r\n and a blank line after every row.

Related to #49 (SDK-382)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@linear-code

linear-code Bot commented Nov 27, 2026

Copy link
Copy Markdown

SDK-382

@greptile-apps

greptile-apps Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Confidence Score: 5/5 · The PR appears safe to merge.RetriggerView in GreptileConfidence Score: 5/5

[Low impact] The PR appears safe to merge.

Reviews (1) · Last reviewed commit: "fix: open CSV export file with newline='..." · Reviewed by Greptile

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant